package com.macro.ai.ollama.controller;

import org.springframework.ai.ollama.OllamaChatModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @ClassName OllamaController
 * @Description TODO
 * @Author wanghong
 * @Date 2025/6/21 13:17
 * @Version 1.0
 **/
@RestController
public class OllamaController {

    @Autowired
    private OllamaChatModel chatModel;

    @GetMapping("/ollama")
    public String ollama(@RequestParam(value="message",defaultValue = "hello")
                             String message) {
        String result = chatModel.call(message);
        return result;
    }
}
